package com.md24housecall.dialog;

import com.md24housecall.activity.R;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.view.View;
import android.view.Window;

public class DialogTermsAndCondition extends Dialog{

	private WebView web;
	private final String URL="file:///android_asset/telemedicine_term_and_condition.html";
	private Button btnOk;
	public DialogTermsAndCondition(Context context) {
		super(context);
		// TODO Auto-generated constructor stub
	}
	
	@SuppressLint("SetJavaScriptEnabled")
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.dialog_terms_and_conditions);
		btnOk=(Button)findViewById(R.id.btn_dlg_TermOk);
		btnOk.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				DialogTermsAndCondition.this.dismiss();
			}
		});
		btnOk.setVisibility(View.GONE);
		web=(WebView)findViewById(R.id.webTermsAndConditions);
		web.getSettings().setJavaScriptEnabled(true);
		web.loadUrl(URL);
		web.setWebViewClient(new WebViewClient(){
			@Override
			public void onPageFinished(WebView view, String url) {
				// TODO Auto-generated method stub
				super.onPageFinished(view, url);
				btnOk.setVisibility(View.VISIBLE);
			}
		});
	}
}
